package 线程;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * @author:谢君臣
 * @Date:2021/9/14-23:52
 * @version:1.0
 * @function:
 */
public class 线程池 {
    public static void main(String[] args) {
        ExecutorService executors =  Executors.newFixedThreadPool(10);
        Future<?> future = executors.submit(() -> System.out.println("A"));
        executors.execute(()-> System.out.println("A"));
        try {
            System.out.println(future.get());
        } catch (InterruptedException | ExecutionException e) {
            e.printStackTrace();
        }
        executors.shutdown();
    }
}
